package com.sky.mapper;

import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SetmealMapper {

    List<Setmeal> selectAllSetmeal(SetmealPageQueryDTO setmealPageQueryDTO);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into setmeal (name, category_id, price, status, description, image, create_time, update_time, create_user, update_user)" +
            "values (#{name},#{categoryId},#{price},#{status},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void insertSetmeal(Setmeal setmeal);

    @Select("select * from setmeal where id = #{id}")
    Setmeal selectById(Integer id);

    void deletesSetmine(List<Integer> ids);

    void updateSetmeal(Setmeal setmeal);

    @Update("update setmeal set status=#{status} where id = #{id}")
    void updateSetmeals(Integer status, Long id);

    @Select("select * from setmeal where id = #{d}")
    List<SetmealVO> selectSetmealById(Long d);

    @Select("select * from setmeal where category_id = #{categoryId}")
    List<Setmeal> selectDishById(Long categoryId);
}
